package com.powernode;

import java.io.Serializable;

//  建造者模式
public class Doctor implements Serializable {
    private Integer id; // 主键
    private String name; // 姓名
    private Integer age; // 年龄
    private String address; // 地址

    //    声明一个静态方法
    private static DoctorBuilder builder() {
        return new DoctorBuilder();
    }
//    get,set方法

    public Integer getId() {
        return id;
    }

    public Integer getAge() {
        return age;
    }

    public String getName() {
        return name;
    }

    public String getAddress() {
        return address;
    }

    //    set方法返回doctor
    public Doctor setId(Integer id) {
        this.id = id;
        return this;
    }

    public Doctor setAge(Integer age) {
        this.age = age;
        return this;
    }

    public Doctor setName(String name) {
        this.name = name;
        return this;
    }

    public Doctor setAddress(String address) {
        this.address = address;
        return this;
    }

    //    重写equals方法
    public boolean equals(Object obj) {
        if (obj == this) {
            return true;
        } else if (!(obj instanceof Doctor)) {
            return false;
        } else {
            Doctor doctor = (Doctor) obj;
            if (!obj.getClass().isInstance(this)) {
                return false;
            } else {
                label59:
                {
                    Object this$id = this.getId();
                    Object other$id = doctor.getId();
                    if (this$id == null) {
                        if (other$id == null) {
                            break label59;
                        }
                    } else if (this$id.equals(other$id)) {
                        break label59;
                    }

                    return false;
                }

                Object this$name = this.getName();
                Object other$name = doctor.getName();
                if (this$name == null) {
                    if (other$name != null) {
                        return false;
                    }
                } else if (!this$name.equals(other$name)) {
                    return false;
                }

                Object this$age = this.getAge();
                Object other$age = doctor.getAge();
                if (this$age == null) {
                    if (other$age != null) {
                        return false;
                    }
                } else if (!this$age.equals(other$age)) {
                    return false;
                }

                Object this$address = this.getAddress();
                Object other$address = doctor.getAddress();
                if (this$address == null) {
                    if (other$address != null) {
                        return false;
                    }
                } else if (!this$address.equals(other$address)) {
                    return false;
                }
                return true;
            }
        }
    }

    protected boolean canEqual(Object other) {
        return other instanceof Doctor;
    }

    public int hashCode() {
        boolean PRIME = true;
        int result = 1;
        Object $id = this.getId();
        result = result * 59 + ($id == null ? 43 : $id.hashCode());
        Object $age = this.getAge();
        result = result * 59 + ($age == null ? 43 : $age.hashCode());
        Object $name = this.getName();
        result = result * 59 + ($name == null ? 43 : $name.hashCode());
        Object $address = this.getAddress();
        result = result * 59 + ($address == null ? 43 : $address.hashCode());
        return result;
    }

    public String toString() {
        return "Teacher(id=" + this.getId() + ", name=" + this.getName() + ", age=" + this.getAge() + ", address=" + this.getAddress() + ")";
    }

    public Doctor(Integer id, String name, Integer age, String address) {
        this.id = id;
        this.name = name;
        this.age = age;
        this.address = address;
    }

    public Doctor() {
    }

    public static class DoctorBuilder {
        private Integer id;
        private String name;
        private Integer age;
        private String address;

        DoctorBuilder() {
        }

        public Doctor.DoctorBuilder id(Integer id) {
            this.id = id;
            return this;
        }

        public Doctor.DoctorBuilder name(String name) {
            this.name = name;
            return this;
        }

        public Doctor.DoctorBuilder age(Integer age) {
            this.age = age;
            return this;
        }

        public Doctor.DoctorBuilder address(String address) {
            this.address = address;
            return this;
        }

        public Doctor build() {
            return new Doctor(this.id, this.name, this.age, this.address);
        }

        public String toString() {
            return "Doctor.DoctorBuilder(id=" + this.id + ", name=" + this.name + ", age=" + this.age + ", address=" + this.address + ")";
        }
    }
}
